'use strict';

const Service = require('egg').Service;

class ProjectlistService extends Service {
  // 查询所有项目
  async showAllProjects() {
    const { mysql } = this.app
    const result = await mysql.select('project_list')
    return result
  }

  // 添加项目
  async createProject(project_name, project_desc, project_pm, project_programmer) {
    const { mysql } = this.app
    const addProject = await mysql.insert('project_list', {
      project_name,
      project_desc,
      project_pm,
      project_programmer
    })
    return addProject
  }
}

module.exports = ProjectlistService;
